USE Vehicle
GO

/* Clear the old tables */

IF OBJECT_ID('vds_invalid_items') IS NOT NULL
	DROP TABLE vds_invalid_items;
GO

IF OBJECT_ID('vds_images') IS NOT NULL
	DROP TABLE vds_images;
GO

IF OBJECT_ID('vds_outline_items') IS NOT NULL
	DROP TABLE vds_outline_items;
GO

IF OBJECT_ID('vds_image_type') IS NOT NULL
	DROP TABLE vds_image_type;
GO

IF OBJECT_ID('vds_log') IS NOT NULL
	BEGIN
		IF OBJECT_ID('vds_log_delete_trigger') IS NOT NULL
			DROP TRIGGER vds_log_delete_trigger;
		DROP TABLE vds_log;
	END;
GO

IF OBJECT_ID('vds_tasks') IS NOT NULL
	DROP TABLE vds_tasks;
GO

IF OBJECT_ID('vds_vehicle_information') IS NOT NULL
	DROP TABLE vds_vehicle_information;
GO

IF OBJECT_ID('vds_license_plate_type') IS NOT NULL
	DROP TABLE vds_license_plate_type;
GO

IF OBJECT_ID('vds_vehicle_type') IS NOT NULL
	DROP TABLE vds_vehicle_type;
GO

IF OBJECT_ID('vds_body_color') IS NOT NULL
	DROP TABLE vds_body_color;
GO

IF OBJECT_ID('vds_fuel_type') IS NOT NULL
	DROP TABLE vds_fuel_type;
GO

IF OBJECT_ID('vds_device_status') IS NOT NULL
	DROP TABLE vds_device_status;
GO

IF OBJECT_ID('vds_device_information') IS NOT NULL
	BEGIN
		IF OBJECT_ID('vds_device_information_delete_trigger') IS NOT NULL
			DROP TRIGGER vds_device_information_delete_trigger;
		DROP TABLE vds_device_information;
	END;
GO

IF OBJECT_ID('vds_user') IS NOT NULL
	BEGIN
		IF OBJECT_ID('vds_user_delete_trigger') IS NOT NULL
			DROP TRIGGER vds_user_delete_trigger;
		DROP TABLE vds_user;
	END;
GO

IF OBJECT_ID('vds_settings') IS NOT NULL
	DROP TABLE vds_settings;
GO

/* Create tables */

CREATE TABLE vds_settings
(
	_id INT IDENTITY PRIMARY KEY,
	_groupName VARCHAR(32) NOT NULL UNIQUE,
	_sessionTimeout BIGINT,
	_enabled BIT DEFAULT 0 NOT NULL
);
GO

CREATE TABLE vds_user
(
	_id INT IDENTITY PRIMARY KEY,
	_user VARCHAR(64) NOT NULL UNIQUE,
	_password CHAR(56),
	_createdTime DATETIME DEFAULT GETDATE() NOT NULL
);
GO

CREATE TABLE vds_device_information
(
	_id INT IDENTITY PRIMARY KEY,
	_model VARCHAR(64),
	_imei CHAR(15) NOT NULL UNIQUE,
	_imeiSv CHAR(2),
	_serialNo VARCHAR(64),
	_wlanMac CHAR(17),
	_osVersion VARCHAR(16),
	_registrationTime DATETIME DEFAULT GETDATE() NOT NULL
);
GO

CREATE TABLE vds_device_status
(
	_id INT IDENTITY PRIMARY KEY,
	_deviceId INT NOT NULL UNIQUE,
	_currentUserId INT,
	_expiredTime DATETIME,
	FOREIGN KEY (_deviceId) REFERENCES vds_device_information(_id),
	FOREIGN KEY (_currentUserId) REFERENCES vds_user(_id)
);
GO

CREATE TABLE vds_license_plate_type
(
	_id INT PRIMARY KEY,
	_code VARCHAR(2) NOT NULL UNIQUE,
	_name VARCHAR(16)
);
GO

CREATE TABLE vds_vehicle_type
(
	_id INT PRIMARY KEY,
	_code VARCHAR(3) NOT NULL UNIQUE,
	_name VARCHAR(16)
);
GO

CREATE TABLE vds_body_color
(
	_id INT PRIMARY KEY,
	_code VARCHAR(1) NOT NULL UNIQUE,
	_name VARCHAR(6)
);
GO

CREATE TABLE vds_fuel_type
(
	_id INT PRIMARY KEY,
	_code VARCHAR(1) NOT NULL UNIQUE,
	_name VARCHAR(8)
);
GO

CREATE TABLE vds_vehicle_information
(
	_id INT IDENTITY PRIMARY KEY,
	_licensePlateNumber VARCHAR(15) NOT NULL,
	_licensePlateType INT NOT NULL,
	_vin VARCHAR(25),
	_vehicleType INT NOT NULL,
	_brandAndModel VARCHAR(20),
	_bodyColor INT NOT NULL,
	_engineModel VARCHAR(20),
	_fuelType INT NOT NULL,
	_owners VARCHAR(64),
	_registrationDate DATETIME,
	FOREIGN KEY (_licensePlateType) REFERENCES vds_license_plate_type(_id),
	FOREIGN KEY (_vehicleType) REFERENCES vds_vehicle_type(_id),
	FOREIGN KEY (_bodyColor) REFERENCES vds_body_color(_id),
	FOREIGN KEY (_fuelType) REFERENCES vds_fuel_type(_id)
);
GO

CREATE TABLE vds_tasks
(
	_fid INT IDENTITY PRIMARY KEY,
	_vehicleInformationId INT NOT NULL,
	_deviceId INT,
	_isLocked BIT DEFAULT 0 NOT NULL,
	_timestamp DATETIME DEFAULT GETDATE() NOT NULL,
	FOREIGN KEY (_vehicleInformationId) REFERENCES vds_vehicle_information(_id),
	FOREIGN KEY (_deviceId) REFERENCES vds_device_information(_id)
);
GO

CREATE TABLE vds_log
(
	_fid INT PRIMARY KEY,
	_vehicleInformationId INT NOT NULL,
	_deviceId INT,
	_userId INT,
	_odometerReading INT,
	_notes VARCHAR(1024),
	_timeStamp DATETIME NOT NULL,
	FOREIGN KEY (_vehicleInformationId) REFERENCES vds_vehicle_information(_id),
	FOREIGN KEY (_deviceId) REFERENCES vds_device_information(_id),
	FOREIGN KEY (_userId) REFERENCES vds_user(_id)
);
GO

CREATE TABLE vds_outline_items
(
	_id INT PRIMARY KEY,
	_name VARCHAR(32) NOT NULL UNIQUE
);
GO

CREATE TABLE vds_image_type
(
	_id INT PRIMARY KEY,
	_code VARCHAR(2) NOT NULL UNIQUE,
	_name VARCHAR(16)
);
GO

CREATE TABLE vds_invalid_items
(
	_id INT IDENTITY PRIMARY KEY,
	_fid INT NOT NULL,
	_invalidItemId INT NOT NULL,
	FOREIGN KEY (_fid) REFERENCES vds_log(_fid),
	FOREIGN KEY (_invalidItemId) REFERENCES vds_outline_items(_id)
);
GO

CREATE TABLE vds_images
(
	_id INT IDENTITY PRIMARY KEY,
	_fid INT NOT NULL,
	_imageId INT NOT NULL,
	_imageData IMAGE,
	FOREIGN KEY (_fid) REFERENCES vds_log(_fid),
	FOREIGN KEY (_imageId) REFERENCES vds_image_type(_id)
);
GO

/* Create triggers */

CREATE TRIGGER vds_device_information_delete_trigger
ON vds_device_information
INSTEAD OF DELETE
AS
BEGIN
	UPDATE vds_tasks SET _deviceId = NULL WHERE _deviceId IN (SELECT _id FROM deleted);
	UPDATE vds_log SET _deviceId = NULL WHERE _deviceId IN (SELECT _id FROM deleted);
	DELETE FROM vds_device_status WHERE _id IN (SELECT _id FROM deleted);
	DELETE FROM vds_device_information WHERE _id IN (SELECT _id FROM deleted);
END;
GO

CREATE TRIGGER vds_log_delete_trigger
ON vds_log
INSTEAD OF DELETE
AS
BEGIN
	DELETE FROM vds_invalid_items WHERE _fid IN (SELECT _fid FROM deleted);
	DELETE FROM vds_images WHERE _fid IN (SELECT _fid FROM deleted);
	DELETE FROM vds_log WHERE _fid IN (SELECT _fid FROM deleted);
END;
GO

/* Initialize data */

INSERT INTO vds_settings (_groupName, _sessionTimeout) VALUES ('default', 60000);
INSERT INTO vds_settings (_groupName, _sessionTimeout) VALUES ('custom', NULL);
UPDATE vds_settings SET _enabled = 1 WHERE _groupName = 'default';
GO

/* User DEBUG is used to debug the system, please remove the statement below when the system will be released. */
/* Username: Debug Password: debug */
INSERT INTO vds_user (_user, _password) VALUES ('Debug', '1E42D1D2E1476ACF3BE3F650C4AE7A8FD40629B918DF16891BB4C715');
GO

INSERT INTO vds_license_plate_type VALUES (0, 'O1', '大型汽车号牌');
INSERT INTO vds_license_plate_type VALUES (1, '02', '小型汽车号牌');
INSERT INTO vds_license_plate_type VALUES (2, '03', '使馆汽车号牌');
INSERT INTO vds_license_plate_type VALUES (3, '04', '领馆汽车号牌');
INSERT INTO vds_license_plate_type VALUES (4, '05', '境外汽车号牌');
INSERT INTO vds_license_plate_type VALUES (5, '06', '外籍汽车号牌');
INSERT INTO vds_license_plate_type VALUES (6, '07', '两、三轮摩托车号牌');
INSERT INTO vds_license_plate_type VALUES (7, '08', '轻便摩托车号牌');
INSERT INTO vds_license_plate_type VALUES (8, '09', '使馆摩托车号牌');
INSERT INTO vds_license_plate_type VALUES (9, '10', '领馆摩托车号牌');
INSERT INTO vds_license_plate_type VALUES (10, '11', '境外摩托车号牌');
INSERT INTO vds_license_plate_type VALUES (11, '12', '外籍摩托车号牌');
INSERT INTO vds_license_plate_type VALUES (12, '13', '农用运输车号牌');
INSERT INTO vds_license_plate_type VALUES (13, '14', '拖拉机号牌');
INSERT INTO vds_license_plate_type VALUES (14, '15', '挂车号牌');
INSERT INTO vds_license_plate_type VALUES (15, '16', '教练汽车号牌');
INSERT INTO vds_license_plate_type VALUES (16, '17', '教练摩托车号牌');
INSERT INTO vds_license_plate_type VALUES (17, '18', '试验汽车号牌');
INSERT INTO vds_license_plate_type VALUES (18, '19', '试验摩托车号牌');
INSERT INTO vds_license_plate_type VALUES (19, '20', '临时人境汽车号牌');
INSERT INTO vds_license_plate_type VALUES (20, '21', '临时人境摩托车号牌');
INSERT INTO vds_license_plate_type VALUES (21, '22', '临时行驶车号牌');
INSERT INTO vds_license_plate_type VALUES (22, '23', '警用汽车号牌');
INSERT INTO vds_license_plate_type VALUES (23, '24', '警用摩托号牌');
INSERT INTO vds_license_plate_type VALUES (24, '99', '其他号牌');
GO

INSERT INTO vds_vehicle_type VALUES (0, 'Kll', '大型普通客车');
INSERT INTO vds_vehicle_type VALUES (1, 'K12', '大型双层客车');
INSERT INTO vds_vehicle_type VALUES (2, 'K13', '大型卧铺客车');
INSERT INTO vds_vehicle_type VALUES (3, 'K14', '大型铰接客车');
INSERT INTO vds_vehicle_type VALUES (4, 'K15', '大型越野客车');
INSERT INTO vds_vehicle_type VALUES (5, 'K21', '中型普通客车');
INSERT INTO vds_vehicle_type VALUES (6, 'K22', '中型双层客车');
INSERT INTO vds_vehicle_type VALUES (7, 'K23', '中型卧铺客车');
INSERT INTO vds_vehicle_type VALUES (8, 'K24', '中型铰接客车');
INSERT INTO vds_vehicle_type VALUES (9, 'K25', '中型越野客车');
INSERT INTO vds_vehicle_type VALUES (10, 'K31', '小型普通客车');
INSERT INTO vds_vehicle_type VALUES (11, 'K32', '小型越野客车');
INSERT INTO vds_vehicle_type VALUES (12, 'K33', '轿车');
INSERT INTO vds_vehicle_type VALUES (13, 'K41', '微型普通客车');
INSERT INTO vds_vehicle_type VALUES (14, 'K42', '微型越野客车');
INSERT INTO vds_vehicle_type VALUES (15, 'K43', '微型轿车');
INSERT INTO vds_vehicle_type VALUES (16, 'H11', '重型普通货车');
INSERT INTO vds_vehicle_type VALUES (17, 'H12', '重型厢式货车');
INSERT INTO vds_vehicle_type VALUES (18, 'H13', '重型封闭货车');
INSERT INTO vds_vehicle_type VALUES (19, 'H14', '重型罐式货车');
INSERT INTO vds_vehicle_type VALUES (20, 'H15', '重型平板货车');
INSERT INTO vds_vehicle_type VALUES (21, 'H16', '重型集装厢车');
INSERT INTO vds_vehicle_type VALUES (22, 'H17', '重型自卸货车');
INSERT INTO vds_vehicle_type VALUES (23, 'H18', '重型特殊结构货车');
INSERT INTO vds_vehicle_type VALUES (24, 'H21', '中型普通货车');
INSERT INTO vds_vehicle_type VALUES (25, 'H22', '中型厢式货车');
INSERT INTO vds_vehicle_type VALUES (26, 'H23', '中型封闭货车');
INSERT INTO vds_vehicle_type VALUES (27, 'H24', '中型罐式货车');
INSERT INTO vds_vehicle_type VALUES (28, 'H25', '中型平板货车');
INSERT INTO vds_vehicle_type VALUES (29, 'H26', '中型集装厢车');
INSERT INTO vds_vehicle_type VALUES (30, 'H27', '中型自卸货车');
INSERT INTO vds_vehicle_type VALUES (31, 'H28', '中型特殊结构货车');
INSERT INTO vds_vehicle_type VALUES (32, 'H31', '轻型普通货车');
INSERT INTO vds_vehicle_type VALUES (33, 'H32', '轻型厢式货车');
INSERT INTO vds_vehicle_type VALUES (34, 'H33', '轻型封闭货车');
INSERT INTO vds_vehicle_type VALUES (35, 'H34', '轻型罐式货车');
INSERT INTO vds_vehicle_type VALUES (36, 'H35', '轻型平板货车');
INSERT INTO vds_vehicle_type VALUES (37, 'H37', '轻型自卸货车');
INSERT INTO vds_vehicle_type VALUES (38, 'H38', '轻型特殊结构货车');
INSERT INTO vds_vehicle_type VALUES (39, 'H41', '微型普通货车');
INSERT INTO vds_vehicle_type VALUES (40, 'H42', '微型厢式货车');
INSERT INTO vds_vehicle_type VALUES (41, 'H43', '微型封闭货车');
INSERT INTO vds_vehicle_type VALUES (42, 'H44', '微型罐式货车');
INSERT INTO vds_vehicle_type VALUES (43, 'H45', '微型自卸货车');
INSERT INTO vds_vehicle_type VALUES (44, 'H46', '微型特殊结构货车');
INSERT INTO vds_vehicle_type VALUES (45, 'H51', '低速普通货车');
INSERT INTO vds_vehicle_type VALUES (46, 'H52', '低速厢式货车');
INSERT INTO vds_vehicle_type VALUES (47, 'H53', '低速罐式货车');
INSERT INTO vds_vehicle_type VALUES (48, 'H54', '低速自卸货车');
INSERT INTO vds_vehicle_type VALUES (49, 'Q11', '重型半挂牵引车');
INSERT INTO vds_vehicle_type VALUES (50, 'Q21', '中型半挂牵引车');
INSERT INTO vds_vehicle_type VALUES (51, 'Q31', '轻型半挂牵引车');
INSERT INTO vds_vehicle_type VALUES (52, 'Z', '专项作业车');
INSERT INTO vds_vehicle_type VALUES (53, 'Z11', '大型专项作业车');
INSERT INTO vds_vehicle_type VALUES (54, 'Z21', '中型专项作业车');
INSERT INTO vds_vehicle_type VALUES (55, 'Z31', '小型专项作业车');
INSERT INTO vds_vehicle_type VALUES (56, 'Z41', '微型专项作业车');
INSERT INTO vds_vehicle_type VALUES (57, 'Z51', '重型专项作业车');
INSERT INTO vds_vehicle_type VALUES (58, 'Z71', '轻型专项作业车');
INSERT INTO vds_vehicle_type VALUES (59, 'D11', '无轨电车');
INSERT INTO vds_vehicle_type VALUES (60, 'D12', '有轨电车');
INSERT INTO vds_vehicle_type VALUES (61, 'M11', '普通正三轮摩托车');
INSERT INTO vds_vehicle_type VALUES (62, 'M12', '轻便正三轮摩托车');
INSERT INTO vds_vehicle_type VALUES (63, 'M13', '正三轮载客摩托车');
INSERT INTO vds_vehicle_type VALUES (64, 'M14', '正三轮载货摩托车');
INSERT INTO vds_vehicle_type VALUES (65, 'M15', '侧三轮摩托车');
INSERT INTO vds_vehicle_type VALUES (66, 'M21', '普通二轮摩托车');
INSERT INTO vds_vehicle_type VALUES (67, 'M22', '轻便二轮摩托车');
INSERT INTO vds_vehicle_type VALUES (68, 'N11', '三轮汽车');
INSERT INTO vds_vehicle_type VALUES (69, 'T11', '大型轮式拖拉机');
INSERT INTO vds_vehicle_type VALUES (70, 'T21', '小型轮式拖拉机');
INSERT INTO vds_vehicle_type VALUES (71, 'T22', '手扶拖拉机');
INSERT INTO vds_vehicle_type VALUES (72, 'T23', '手扶变形运输机');
INSERT INTO vds_vehicle_type VALUES (73, 'J11', '轮式装载机械');
INSERT INTO vds_vehicle_type VALUES (74, 'J12', '轮式挖掘机械');
INSERT INTO vds_vehicle_type VALUES (75, 'J13', '轮式平地机械');
INSERT INTO vds_vehicle_type VALUES (76, 'G11', '重型普通全挂车');
INSERT INTO vds_vehicle_type VALUES (77, 'G12', '重型厢式全挂车');
INSERT INTO vds_vehicle_type VALUES (78, 'G13', '重型罐式全挂车');
INSERT INTO vds_vehicle_type VALUES (79, 'G14', '重型平板全挂车');
INSERT INTO vds_vehicle_type VALUES (80, 'G15', '重型集装箱全挂车');
INSERT INTO vds_vehicle_type VALUES (81, 'G16', '重型自卸全挂车');
INSERT INTO vds_vehicle_type VALUES (82, 'G21', '中型普通全挂车');
INSERT INTO vds_vehicle_type VALUES (83, 'G22', '中型厢式全挂车');
INSERT INTO vds_vehicle_type VALUES (84, 'G23', '中型罐式全挂车');
INSERT INTO vds_vehicle_type VALUES (85, 'G24', '中型平板全挂车');
INSERT INTO vds_vehicle_type VALUES (86, 'G25', '中型集装箱全挂车');
INSERT INTO vds_vehicle_type VALUES (87, 'G26', '中型自卸全挂车');
INSERT INTO vds_vehicle_type VALUES (88, 'G31', '轻型普通全挂车');
INSERT INTO vds_vehicle_type VALUES (89, 'G32', '轻型厢式全挂车');
INSERT INTO vds_vehicle_type VALUES (90, 'G33', '轻型罐式全挂车');
INSERT INTO vds_vehicle_type VALUES (91, 'G34', '轻型平板全挂车');
INSERT INTO vds_vehicle_type VALUES (92, 'G35', '轻型自卸全挂车');
INSERT INTO vds_vehicle_type VALUES (93, 'B11', '重型普通半挂车');
INSERT INTO vds_vehicle_type VALUES (94, 'B12', '重型厢式半挂车');
INSERT INTO vds_vehicle_type VALUES (95, 'B13', '重型罐式半挂车');
INSERT INTO vds_vehicle_type VALUES (96, 'B14', '重型平板半挂车');
INSERT INTO vds_vehicle_type VALUES (97, 'B15', '重型集装箱半挂车');
INSERT INTO vds_vehicle_type VALUES (98, 'B16', '重型自卸半挂车');
INSERT INTO vds_vehicle_type VALUES (99, 'B17', '重型特殊结构半挂车');
INSERT INTO vds_vehicle_type VALUES (100, 'B21', '中型普通半挂车');
INSERT INTO vds_vehicle_type VALUES (101, 'B22', '中型厢式半挂车');
INSERT INTO vds_vehicle_type VALUES (102, 'B23', '中型罐式半挂车');
INSERT INTO vds_vehicle_type VALUES (103, 'B24', '中型平板半挂车');
INSERT INTO vds_vehicle_type VALUES (104, 'B25', '中型集装箱半挂车');
INSERT INTO vds_vehicle_type VALUES (105, 'B26', '中型自卸半挂车');
INSERT INTO vds_vehicle_type VALUES (106, 'B27', '中型特殊结构半挂车');
INSERT INTO vds_vehicle_type VALUES (107, 'B31', '轻型普通半挂车');
INSERT INTO vds_vehicle_type VALUES (108, 'B32', '轻型厢式半挂车');
INSERT INTO vds_vehicle_type VALUES (109, 'B33', '轻型罐式半挂车');
INSERT INTO vds_vehicle_type VALUES (110, 'B34', '轻型平板半挂车');
INSERT INTO vds_vehicle_type VALUES (111, 'B35', '轻型自卸半挂车');
INSERT INTO vds_vehicle_type VALUES (112, 'X99', '其他');
GO

INSERT INTO vds_body_color VALUES (0, 'A', '白');
INSERT INTO vds_body_color VALUES (1, 'B', '灰');
INSERT INTO vds_body_color VALUES (2, 'C', '黄');
INSERT INTO vds_body_color VALUES (3, 'D', '粉');
INSERT INTO vds_body_color VALUES (4, 'E', '红');
INSERT INTO vds_body_color VALUES (5, 'F', '紫');
INSERT INTO vds_body_color VALUES (6, 'G', '绿');
INSERT INTO vds_body_color VALUES (7, 'H', '蓝');
INSERT INTO vds_body_color VALUES (8, 'I', '棕');
INSERT INTO vds_body_color VALUES (9, 'J', '黑');
INSERT INTO vds_body_color VALUES (10, 'Z', '其他');
GO

INSERT INTO vds_fuel_type VALUES (0, 'A', '汽油');
INSERT INTO vds_fuel_type VALUES (1, 'B', '柴油');
INSERT INTO vds_fuel_type VALUES (2, 'C', '电');
INSERT INTO vds_fuel_type VALUES (3, 'D', '混合油');
INSERT INTO vds_fuel_type VALUES (4, 'E', '天然气');
INSERT INTO vds_fuel_type VALUES (5, 'F', '液化石油气');
INSERT INTO vds_fuel_type VALUES (6, 'L', '甲醉');
INSERT INTO vds_fuel_type VALUES (7, 'M', '乙醇');
INSERT INTO vds_fuel_type VALUES (8, 'N', '太阳能');
INSERT INTO vds_fuel_type VALUES (9, 'O', '混合动力');
INSERT INTO vds_fuel_type VALUES (10, 'Y', '无');
INSERT INTO vds_fuel_type VALUES (11, 'Z', '其他');
GO

INSERT INTO vds_outline_items VALUES (0, '1.车辆号牌');
INSERT INTO vds_outline_items VALUES (1, '2.车辆类型、品牌/型号');
INSERT INTO vds_outline_items VALUES (2, '3.车身颜色');
INSERT INTO vds_outline_items VALUES (3, '4.VIN（整车出厂编号）');
INSERT INTO vds_outline_items VALUES (4, '5.发动机号码');
INSERT INTO vds_outline_items VALUES (5, '6.主要特征及技术参数');
INSERT INTO vds_outline_items VALUES (6, '7.保险杠');
INSERT INTO vds_outline_items VALUES (7, '8.后视镜*/下视镜*');
INSERT INTO vds_outline_items VALUES (8, '9.车窗玻璃*');
INSERT INTO vds_outline_items VALUES (9, '10.车体周正、尖锐突出物*');
INSERT INTO vds_outline_items VALUES (10, '11.漆面');
INSERT INTO vds_outline_items VALUES (11, '12.货箱/安全架/车外顶行李架*');
INSERT INTO vds_outline_items VALUES (12, '13.车身广告与文字标志、标识*');
INSERT INTO vds_outline_items VALUES (13, '14.自行加装装置*');
INSERT INTO vds_outline_items VALUES (14, '15.整车3C标志');
INSERT INTO vds_outline_items VALUES (15, '16.其他注册登记检验增加项目*');
INSERT INTO vds_outline_items VALUES (16, '17.前位灯/后位灯、侧标志灯');
INSERT INTO vds_outline_items VALUES (17, '18.后牌照灯');
INSERT INTO vds_outline_items VALUES (18, '19.示廓灯/挂车标志灯');
INSERT INTO vds_outline_items VALUES (19, '20.转向信号灯（前、后、侧）、危险警告信号灯');
INSERT INTO vds_outline_items VALUES (20, '21.前照灯（远光、近光）');
INSERT INTO vds_outline_items VALUES (21, '22.制动灯');
INSERT INTO vds_outline_items VALUES (22, '23.后反射器、侧反射器');
INSERT INTO vds_outline_items VALUES (23, '24.后雾灯');
INSERT INTO vds_outline_items VALUES (24, '25.倒车灯');
INSERT INTO vds_outline_items VALUES (25, '26.道路运输危险货物车辆标识');
INSERT INTO vds_outline_items VALUES (26, '27.特种车辆标志灯具');
INSERT INTO vds_outline_items VALUES (27, '28.附加灯具、反射器或附属装置');
INSERT INTO vds_outline_items VALUES (28, '29.喇叭');
INSERT INTO vds_outline_items VALUES (29, '30.车身反光标识');
INSERT INTO vds_outline_items VALUES (30, '31.发动机各系统机件');
INSERT INTO vds_outline_items VALUES (31, '32.蓄电池桩头及联线');
INSERT INTO vds_outline_items VALUES (32, '33.电器导线、各种管路*');
INSERT INTO vds_outline_items VALUES (33, '34.液压制动储液器液面*');
INSERT INTO vds_outline_items VALUES (34, '35.发动机标识*');
INSERT INTO vds_outline_items VALUES (35, '36.门锁及门铰链');
INSERT INTO vds_outline_items VALUES (36, '37.驾驶员座椅*');
INSERT INTO vds_outline_items VALUES (37, '38.安全带*');
INSERT INTO vds_outline_items VALUES (38, '39.风窗玻璃驾驶员视区部位*');
INSERT INTO vds_outline_items VALUES (39, '40.刮水器*');
INSERT INTO vds_outline_items VALUES (40, '41.洗涤器');
INSERT INTO vds_outline_items VALUES (41, '42.汽车行驶记录仪*');
INSERT INTO vds_outline_items VALUES (42, '43.驾驶室固定、安全带*');
INSERT INTO vds_outline_items VALUES (43, '44.仪表数量和类型*');
INSERT INTO vds_outline_items VALUES (44, '45.操纵件、指示器及信号装置的图形标志*');
INSERT INTO vds_outline_items VALUES (45, '46.警告性文字的中文标注*');
INSERT INTO vds_outline_items VALUES (46, '47.车辆产品标牌*');
INSERT INTO vds_outline_items VALUES (47, '48.起动*');
INSERT INTO vds_outline_items VALUES (48, '49.怠速、仪表、电源充电');
INSERT INTO vds_outline_items VALUES (49, '50.加速踏板控制');
INSERT INTO vds_outline_items VALUES (50, '51.漏水、油、气/水温、油压');
INSERT INTO vds_outline_items VALUES (51, '52.关电熄火/ 柴油车停机装置*');
INSERT INTO vds_outline_items VALUES (52, '53.座椅/卧铺数量，座椅间距*');
INSERT INTO vds_outline_items VALUES (53, '54.扶手和卧铺护栏');
INSERT INTO vds_outline_items VALUES (54, '55.车厢灯、门灯');
INSERT INTO vds_outline_items VALUES (55, '56.客车地板、车内行李架');
INSERT INTO vds_outline_items VALUES (56, '57.灭火器、安全出口标识、安全手锤、安全门*');
INSERT INTO vds_outline_items VALUES (57, '58.安全带*');
INSERT INTO vds_outline_items VALUES (58, '59.安全出口的数量、位置和尺寸*');
INSERT INTO vds_outline_items VALUES (59, '60.乘客通道，通往安全门的通道*');
INSERT INTO vds_outline_items VALUES (60, '61.燃料箱、燃料箱盖*');
INSERT INTO vds_outline_items VALUES (61, '62.挡泥板/牵引钩、蓄电池、蓄电池架');
INSERT INTO vds_outline_items VALUES (62, '63.贮气筒排污阀');
INSERT INTO vds_outline_items VALUES (63, '64.钢板弹簧*');
INSERT INTO vds_outline_items VALUES (64, '65.侧面及后下部防护装置*');
INSERT INTO vds_outline_items VALUES (65, '66.牵引连接装置');
INSERT INTO vds_outline_items VALUES (66, '67.轮胎型号/规格/速度级别*');
INSERT INTO vds_outline_items VALUES (67, '68.胎冠花纹深度、胎面*');
INSERT INTO vds_outline_items VALUES (68, '69.轮胎螺栓、半轴螺栓*');
INSERT INTO vds_outline_items VALUES (69, '70.备胎标识*');
INSERT INTO vds_outline_items VALUES (70, '71.其他不符合规定的情形');
INSERT INTO vds_outline_items VALUES (71, '72.方向盘最大自由转动量*');
INSERT INTO vds_outline_items VALUES (72, '73.转向沉重*');
INSERT INTO vds_outline_items VALUES (73, '74.自动回正、直线行驶能力');
INSERT INTO vds_outline_items VALUES (74, '75.离合器');
INSERT INTO vds_outline_items VALUES (75, '76.变速器');
INSERT INTO vds_outline_items VALUES (76, '77.传动轴/链');
INSERT INTO vds_outline_items VALUES (77, '78.驱动桥');
INSERT INTO vds_outline_items VALUES (78, '79.点制动跑偏(20km／h)');
INSERT INTO vds_outline_items VALUES (79, '80.低气压报警装置*');
INSERT INTO vds_outline_items VALUES (80, '81.弹簧储能制动器');
INSERT INTO vds_outline_items VALUES (81, '82.防抱制动装置*');
INSERT INTO vds_outline_items VALUES (82, '83.仪表和指示器*');
INSERT INTO vds_outline_items VALUES (83, '84.转向器固定');
INSERT INTO vds_outline_items VALUES (84, '85.转向各部件');
INSERT INTO vds_outline_items VALUES (85, '86.变速器支架');
INSERT INTO vds_outline_items VALUES (86, '87.分动器支架');
INSERT INTO vds_outline_items VALUES (87, '88.传动各部件');
INSERT INTO vds_outline_items VALUES (88, '89.钢板吊耳*');
INSERT INTO vds_outline_items VALUES (89, '90.吊耳销*');
INSERT INTO vds_outline_items VALUES (90, '91.中心螺栓');
INSERT INTO vds_outline_items VALUES (91, '92.U型螺栓');
INSERT INTO vds_outline_items VALUES (92, '93.车桥移位*');
INSERT INTO vds_outline_items VALUES (93, '94.车架纵梁');
INSERT INTO vds_outline_items VALUES (94, '95.车架横梁');
INSERT INTO vds_outline_items VALUES (95, '96.悬架杆系');
INSERT INTO vds_outline_items VALUES (96, '97.制动系部件、结构改动');
INSERT INTO vds_outline_items VALUES (97, '98.制动主缸、轮缸、制动管路漏气、漏油');
INSERT INTO vds_outline_items VALUES (98, '99.制动软管老化');
INSERT INTO vds_outline_items VALUES (99, '100.制动管路固定');
INSERT INTO vds_outline_items VALUES (100, '101.电器线路检查*');
INSERT INTO vds_outline_items VALUES (101, '102.发动机固定');
INSERT INTO vds_outline_items VALUES (102, '103.排气管、消声器');
INSERT INTO vds_outline_items VALUES (103, '104.燃料管路');
GO

INSERT INTO vds_image_type VALUES (0, '01', '机动车行驶证');
INSERT INTO vds_image_type VALUES (1, '02', '检验合格标志申请表');
INSERT INTO vds_image_type VALUES (2, '03', '机动车交通事故责任强制保险凭证');
INSERT INTO vds_image_type VALUES (3, '04', '机动车安全技术检验报告单');
INSERT INTO vds_image_type VALUES (4, '05', '机动车查验单');
INSERT INTO vds_image_type VALUES (5, '11', '车前斜视45度照片');
INSERT INTO vds_image_type VALUES (6, '12', '车后斜视45度照片');
INSERT INTO vds_image_type VALUES (7, '13', '车辆识别代号照片');
INSERT INTO vds_image_type VALUES (8, '14', '机动车侧面照片');
INSERT INTO vds_image_type VALUES (9, '15', '车内最前方向后照片');
INSERT INTO vds_image_type VALUES (10, '16', '灭火器照片');
INSERT INTO vds_image_type VALUES (11, '17', '安全手锤照片');
INSERT INTO vds_image_type VALUES (12, '18', '行驶记录仪照片');
INSERT INTO vds_image_type VALUES (13, '21', '灯光工位拍摄照片');
INSERT INTO vds_image_type VALUES (14, '22', '制动工位拍摄照片');
INSERT INTO vds_image_type VALUES (15, '99', '其他');
GO